package cn.com.cym.gamezao.repository;

import cn.com.cym.gamezao.base.BaseRepository;
import cn.com.cym.gamezao.entity.Dict;
import cn.com.cym.gamezao.entity.DictItem;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.redis.core.RedisHash;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@RedisHash
@Repository
public interface DictItemRepository extends BaseRepository<DictItem,Long> {

    //@Query("from DictItem  where Dict=:dict and deleted=:deleted")
    List<DictItem> getByDictAndDeleted(Dict dict,Boolean deleted);

    //@Query("from DictItem  where deleted=:deleted")
    List<DictItem> findByDeleted(Boolean deleted);

    @Query("from DictItem  where deleted=:deleted and code=:code")
    DictItem getByCode(@Param("code")String code,@Param("deleted")Boolean deleted);
}
